package cqrtplm.listener;

import cn.hutool.extra.spring.SpringUtil;
import com.hustcad.plm.pdm.workflow.annotion.CustomListener;
import cqrtplm.service.PointSelectionService;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;

@CustomListener(category = "润通", description = "开模通知发送SRM监听器")
public class MouldUnloadingListener implements ExecutionListener {

    @Override
    public void notify(DelegateExecution delegateExecution) {
        String workFlowContainerId = String.valueOf(delegateExecution.getVariable("workFlowContainerId"));
        PointSelectionService pointSelectionService = SpringUtil.getBean(PointSelectionService.class);
        try {
            pointSelectionService.sendMouldUnloading(workFlowContainerId);
        }catch (Exception exception){
            throw new RuntimeException("开模通知发送SRM失败");
        }
    }
}
